#!/usr/bin/python3
# -* - coding: UTF-8 -* -
from selenium import webdriver


class Apgar():

    driver = None
    options = webdriver.ChromeOptions()
    options.add_argument('lang=zh_CN.UTF-8')
    # options.add_argument('headless')
    # options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')

    def __init__(self):
        print('Apgar init...')
        self.driver = webdriver.Chrome(chrome_options=self.options)
        self.driver.implicitly_wait(30)


    @classmethod
    def instance(cls, *args, **kwargs):
        if not hasattr(Apgar, "_instance"):
            Apgar._instance = Apgar(*args, **kwargs)
        return Apgar._instance

    def getDriver(self):
        return self.driver
